<?php

Loader::using("ext::libs::restful::RESTfulClient");
Loader::using("Models::Entities::Puertos");

class PuertosService extends RESTfulClient {

    public function GetAll() {
        $response = $this->call("/", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Puertos", $response);
    }

    public function GetDeleted() {
        $response = $this->call("/Eliminados", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Puertos", $response);
    }

    public function Restore($id) {
        $response = $this->call("/Restaurar/$id", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Puertos", $response);
    }

    public function GetById($id) {
        $response = $this->call("/$id", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Puertos", $response);
    }

    public function GetByPais($idPais, $skip, $range) {
        $response = $this->GetByPaisRaw($idPais, $skip, $range);
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Puertos", $response);
    }
    
    public function GetByPaisRaw($idPais, $skip, $range) {
        return $this->call("/ByPais/$idPais/$skip/$range", "GET");
    }

    public function Update(Puertos $puerto) {
        $serializer = $this->getSerializer();
        $data = $serializer->serialize($puerto);
        $this->call("/{$puerto->getIdPuerto()}", "PUT", $data);
    }

    public function Create(Puertos $puerto) {
        $serializer = $this->getSerializer();
        $data = $serializer->serialize($puerto);
        $this->call("/new", "POST", $data);
    }

    public function Remove($id) {
        $this->call("/$id", "DELETE");
    }

}

?>
